package com.cn.zy.zheda.demo.controller;

import com.cn.zy.zheda.demo.controller.request.Alarm;
import com.cn.zy.zheda.demo.service.DeviceService;
import com.cn.zy.zheda.demo.service.UrlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhangyi
 * @date 2018/12/19 13:47
 */
@RestController
@RequestMapping("/url")
@Deprecated
public class UrlController extends BaseController{

    @Autowired
    private UrlService urlService;

    @Autowired
    private DeviceService deviceService;

    /**
     * 返回报警信息
     *
     * @return
     */
    @PostMapping("/alarm/{customerId}")
    public String alarm(@PathVariable String customerId){
        String token = getToken();
        //获取设备id
        String deviceId = deviceService.getDeviceId(customerId,token);
        Alarm alarm = new Alarm(deviceId,"50","false");
        String alarmMessage = urlService.alarm(alarm, token);
        //继续配装其他的数据

        return alarmMessage;
    }
}
